home *** CD-ROM | disk | FTP | other *** search
/ SBC Yahoo! Dial - Start Y… NeW Internet Experience / SBC Yahoo! Dial - Start.iso / pc / Reg / help / helpcommon.js < prev    next >
Text File  |  2002-04-18  |  7KB  |  285 lines

  1. var storedfocus = "";
  2. var btnClicked = false;
  3.  
  4. if (document.images) {    
  5.     BtnCloseon = new Image(); BtnCloseon.src = "../images/sbc/buttons/close_over.gif";
  6.     BtnCloseoff = new Image(); BtnCloseoff.src = "../images/sbc/buttons/close_out.gif";
  7.     BtnClosedown = new Image(); BtnClosedown.src = "../images/sbc/buttons/close_down.gif";    
  8.     BtnNoon = new Image(); BtnNoon.src = "../images/sbc/buttons/no_over.gif";
  9.     BtnNooff = new Image(); BtnNooff.src = "../images/sbc/buttons/no_out.gif";
  10.     BtnNodown = new Image(); BtnNodown.src = "../images/sbc/buttons/no_down.gif";    
  11.     BtnYeson = new Image(); BtnYeson.src = "../images/sbc/buttons/yes_over.gif";
  12.     BtnYesoff = new Image(); BtnYesoff.src = "../images/sbc/buttons/yes_out.gif";
  13.     BtnYesdown = new Image(); BtnYesdown.src = "../images/sbc/buttons/yes_down.gif";    
  14.     BtnOKon = new Image(); BtnOKon.src = "../images/sbc/buttons/ok_over.gif";
  15.     BtnOKoff = new Image(); BtnOKoff.src = "../images/sbc/buttons/ok_out.gif";
  16.     BtnOKdown = new Image(); BtnOKdown.src = "../images/sbc/buttons/ok_down.gif";    
  17. }
  18.  
  19. function isButton(obj)
  20. {
  21.     return obj && (obj.name == "BtnClose" || obj.name == "BtnNo" || obj.name == "BtnYes" || obj.name == "BtnOK");
  22. }
  23.  
  24. function focusOn() {
  25.     if(isButton(window.event.srcElement))
  26.     {
  27.         if(btnClicked == false)
  28.         {
  29.             storedfocus = window.event.srcElement.name;    
  30.             window.event.srcElement.style.cursor = "hand";
  31.             window.event.srcElement.src = eval(window.event.srcElement.name + "on.src");
  32.         }    
  33.         else
  34.         {
  35.             storedfocus = window.event.srcElement.name;    
  36.             window.event.srcElement.style.cursor = "auto";
  37.             window.event.srcElement.src = eval(window.event.srcElement.name + "down.src");
  38.         }
  39.     }
  40.     return;
  41. }
  42.  
  43. function focusOff() {
  44.     storedfocus = "";
  45.     btnClicked = false;    
  46.     turnOff();
  47. return;
  48. }
  49.  
  50. function turnOn() {    
  51.     if (document.images && isButton(window.event.srcElement)) 
  52.     {    
  53.     if(storedfocus == ""|| storedfocus == window.event.srcElement.name)
  54.         {       
  55.           window.event.srcElement.style.cursor = "hand";
  56.           window.event.srcElement.src = eval(window.event.srcElement.name + "on.src");     
  57.         }
  58.     else
  59.         {
  60.         document.all[storedfocus].src = eval(storedfocus + "off.src");
  61.             //if ( document.all[  window.event.srcElement.name + "on" ]  )
  62.             //{
  63.             window.event.srcElement.style.cursor = "hand";
  64.               window.event.srcElement.src = eval(window.event.srcElement.name + "on.src");     
  65.               //}
  66.         }    
  67.     }
  68.     
  69. return;
  70. }
  71.  
  72. function turnOff() {
  73.     if (document.images && isButton(window.event.srcElement))
  74.     {
  75.         if (storedfocus == "")
  76.         {
  77.               window.event.srcElement.style.cursor = "auto";
  78.               window.event.srcElement.src = eval(window.event.srcElement.name + "off.src");      
  79.           }
  80.           else
  81.           {
  82.               window.event.srcElement.style.cursor = "auto";
  83.               //if ( document.all[  window.event.srcElement.name + "off" ]  )
  84.             //{
  85.                   window.event.srcElement.src = eval(window.event.srcElement.name + "off.src");      
  86.                   document.all[storedfocus].src = eval(storedfocus + "on.src");
  87.               //}
  88.           }          
  89.     }
  90.     
  91. return;
  92. }
  93.  
  94. function FixMouse()
  95. {
  96.     var i;
  97.     var x = document.images.length;
  98.     for (i = 0; i < x; i++) 
  99.     {            
  100.         if (document.images(i).name != "")
  101.         {
  102.             var base2 = document.images(i).name.substr(0,3);
  103.             if ( base2 == "Btn")
  104.                 if (document.images(i).src == eval (document.images(i).name + "down.src"))
  105.                 {
  106.                     if(document.images(i).name == storedfocus)
  107.                         document.images(i).src = eval (document.images(i).name + "on.src");
  108.                     else
  109.                         document.images(i).src = eval (document.images(i).name + "off.src");
  110.                 }
  111.                 //else if(document.images(i).src == eval (document.images(i).name + "on.src") && document.images(i).name == storedfocus)
  112.                     //document.images(i).src = eval (document.images(i).name + "off.src");
  113.         }
  114.     }
  115.  
  116. return;
  117. }
  118.  
  119. function turnDown() {
  120.     if (document.images && isButton(window.event.srcElement))
  121.     {
  122.       btnClicked = true;
  123.       window.event.srcElement.style.cursor = "auto";
  124.       window.event.srcElement.src = eval(window.event.srcElement.name + "down.src");      
  125.     }
  126. return;
  127. }
  128.  
  129. function onClose(){
  130. window.close();
  131. return false;
  132. }
  133.  
  134. function onYes(){
  135. document.forms[0].action = "http://localaction.bogus.yahoo.moc/actionCancelYes?";
  136. document.forms[0].submit();
  137. return false;
  138. }
  139.  
  140. function onNo(){
  141. document.forms[0].action = "http://localaction.bogus.yahoo.moc/actionCancelNo?";
  142. document.forms[0].submit();
  143. return false;
  144. }
  145.  
  146. function DocumentOnKeyPress()
  147. {        
  148.     if( event.keyCode == 32)
  149.     {
  150.         if (storedfocus == "BtnClose")
  151.         {
  152.              onClose();
  153.              window.event.returnValue = false;
  154.         }
  155.         else if (storedfocus == "BtnYes")
  156.         {
  157.              onYes();
  158.              window.event.returnValue = false;
  159.         }
  160.         else if (storedfocus == "BtnNo")
  161.         {
  162.              onNo();
  163.              window.event.returnValue = false;
  164.         }
  165.         else if (storedfocus == "BtnOK")
  166.         {
  167.              onClose();
  168.              window.event.returnValue = false;
  169.         }
  170.     }    
  171. }
  172.  
  173. function DocumentOnKeyUp()
  174. {        
  175.     if( event.keyCode == 13)
  176.     {
  177.         if (storedfocus == "BtnClose")
  178.         {
  179.              onClose();
  180.              window.event.returnValue = false;
  181.         }
  182.         else if (storedfocus == "BtnYes")        
  183.         {
  184.              onYes();             
  185.              window.event.returnValue = false;
  186.         }
  187.         else if (storedfocus == "BtnNo")        
  188.         {
  189.              onNo();             
  190.              window.event.returnValue = false;
  191.         }
  192.         else if (storedfocus == "BtnOK")    
  193.         {
  194.              onClose();
  195.              window.event.returnValue = false;
  196.         }
  197.         else if( document.all("BtnClose") != null )
  198.         {
  199.           onClose();
  200.           window.event.returnValue = false;          
  201.         }
  202.         else if( document.all("BtnOK") != null )
  203.         {
  204.           onClose();
  205.           window.event.returnValue = false;
  206.         }
  207.         else if( document.all("BtnYes") != null )
  208.         {
  209.           onYes();
  210.           window.event.returnValue = false;
  211.         }        
  212.     }
  213.     
  214.     if( event.keyCode == 27)
  215.     {        
  216.         if( document.all("BtnClose") != null )
  217.         {
  218.           onClose();
  219.           window.event.returnValue = false;          
  220.         }
  221.         else if( document.all("BtnNo") != null )
  222.         {
  223.           onNo();
  224.           window.event.returnValue = false;
  225.         }
  226.         else if( document.all("BtnOK") != null )
  227.         {
  228.           onClose();
  229.           window.event.returnValue = false;
  230.         }
  231.     }
  232. }
  233.  
  234. function onStopDrag()
  235. {
  236.     window.event.returnValue = false;
  237.     window.event.cancelBubble = true;
  238.     window.event.dataTransfer.dropEffect = "none";
  239.     window.event.dataTransfer.effectAllowed = "none";
  240.     return false;
  241. }
  242.  
  243. function DocumentOnKeyPressX()
  244. {
  245.     var namecheck = window.event.srcElement.name;
  246.     var base2 ="";
  247.     
  248.     if( event.keyCode == 32)
  249.     {
  250.         if (namecheck)
  251.             base2 = namecheck.substr( 0, 3 );
  252.     
  253.         if( window.event.srcElement.type == "text"  || base2 == "Btn")
  254.         {        
  255.             if (storedfocus == "BtnClose")
  256.             {
  257.                  onClose();
  258.                  window.event.returnValue = false;
  259.             }
  260.             else if (storedfocus == "BtnYes")
  261.             {
  262.                  onYes();
  263.                  window.event.returnValue = false;
  264.             }
  265.             else if (storedfocus == "BtnNo")
  266.             {
  267.                  onNo();
  268.                  window.event.returnValue = false;
  269.             }
  270.             else if (storedfocus == "BtnOK")
  271.             {
  272.                  onClose();
  273.                  window.event.returnValue = false;
  274.             }        
  275.         }
  276.         else
  277.             window.event.returnValue = false;
  278.     }
  279. }
  280.  
  281. document.onkeyup = DocumentOnKeyUp;
  282. document.onkeypress = DocumentOnKeyPressX;
  283. document.ondragstart = onStopDrag;
  284. document.onmouseup = FixMouse;    
  285.